package dancrawler.client.gamecmd;

import dancrawler.common.Misc;
import dancrawler.client.Client;
import dancrawler.proto.cmd.CmdHandler;
import dancrawler.server.netMsg;

/**
 *
 */
public class CmdSetFocus extends CmdHandler{
    private Client client;
    public CmdSetFocus(Client client)
    {
        this.client = client;
    }

    @Override
    public void handleCmd(netMsg msg) {
        int id = Misc.bytesToShort(msg.getArgs()[0]);
        client.setFocus(id);
        System.out.println("SETFOCUS " + id);
    }

    @Override
    public int getNumArgs() {
        return 1;
    }

    @Override
    public int getId() {
        return 7;
    }

    @Override
    public int getArgSize(int n) {

        int[] argsize = {2};
        if(n > getNumArgs()-1)
        {
            return 0;
        }
        return argsize[n];
    }

    @Override
    public CmdHandler getHandler() {
        return this;
    }

}
